
<?php
session_start();

mysql_connect("localhost","root","") or die ("sorry..");
mysql_select_db("books");
$email = $_POST['email'];
$password = $_POST['password'];

$qry ="select * from login where emailid='".$email."' and password='".$password."'";
$rs= mysql_query($qry);
$rs_data=mysql_fetch_array($rs);

$qry_user="select * from customerinfo where custid='".$rs_data["custid"]."'";
$rs_user =mysql_query($qry_user);

if($rs)
 {
  $i=0;
  while($rs_data_user=mysql_fetch_array($rs_user))
  {
  $i++;
   $_SESSION['session_user']=$rs_data_user["name"];
   $_SESSION['msg']= "1";
   }
   if($i>0){
	header("location:user_home.php");
	}
	else{
die("Incorrect user name or password");
	}
}
else
{
die("login failed..................");
} 
?>
